<HTML><HEAD><TITLE>chr_resolve(+Constraint)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(chr)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>chr_resolve(+Constraint)</H1>
Uses the Prolog clauses to solve a constraint Constraint.


<DL>
<DT><EM>+Constraint</EM></DT>
<DD>A constraint (callable term) defined by constraint handling                rules.
</DD>
</DL>
<H2>Description</H2>
   Uses the Prolog clauses to solve a constraint Constraint.  Used by
   advanced constraint handling rules users to program labeling procedures
   for the constraints defined by constraint handling rules.

<P>

<H3>Fail Conditions</H3>
   Fails if there are no Prolog clauses for the constraint or if the bodies
   of all clauses fail.


<H3>Resatisfiable</H3>
   Yes.
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Constraint is a free variable.
<DT><EM>(6) out of range </EM>
<DD>Constraint is term which is not a constraint (defined by    constraint handling rules).
</DL>
<H2>Examples</H2>
<PRE>   Example using the constraint handler for Booleans in file  bool.chr:
[eclipse]: chr_resolve(X).
instantiation fault in is_predicate(_g671 / _g639)

[eclipse]: chr_resolve(and(X,Y)).
out of range in chr_resolve(and(X,Y))

[eclipse]: chr_resolve(and(X,Y,Z)).

X = 0
Y = Y
Z = 0     More? (;)

X = 1
Y = Z
Z = Z
yes.

[eclipse]: chr_resolve(and(a,b,c)).
no (more) solution.


   The predicate chr_labeling/0 can be defined as:
labeling :-
   chr_get_constraint(C),
   chr_label_with(C),
   !,
   chr_resolve(C),
   labeling.

labeling.



</PRE>
<H2>See Also</H2>
<A HREF="../../lib/chr/chr_labeling-0.html">chr_labeling / 0</A>, <A HREF="../../lib/chr/chr_label_with-1.html">chr_label_with / 1</A>, <A HREF="../../lib/chr/chr_get_constraint-1.html">chr_get_constraint / 1</A>, <A HREF="../../lib/chr/chr_get_constraint-2.html">chr_get_constraint / 2</A>
</BODY></HTML>
